package com.hnas.trade.domain;

public enum TranState {
	Normal("01", "正常"), Reversed("02", "已冲正"), Rescinded("03", "已撤销"), Returned("04", "已退货");

	private String state;
	private String description;

	private TranState(String state, String description) {
		this.state = state;
		this.description = description;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public static TranState getTranState(String key) {
		for (TranState tranState : TranState.values()) {
			if (tranState.getState().equals(key)) {
				return tranState;
			}
		}
		return null;
	}

	public static String getTranStateString(String key) {
		return getTranState(key) == null ? "" : getTranState(key).getDescription();
	}
}
